﻿using System;
using System.Collections;
namespace Malu.Entity
{
    public class AjaxProResult
    {
        private Object _Value = null;
        public Object Value
        {
            get
            {
                return _Value;
            }
            set
            {
                _Value = value;
            }
        }
        private int _ErrorCode = 0;
        public int ErrorCode
        {
            get
            {
                return _ErrorCode;
            }
            set
            {
                _ErrorCode = value;
            }
        }
        private string _Message = "";
        public string Message
        {
            get
            {
                return _Message;
            }
            set
            {
                _Message = value;
            }
        }
        public AjaxProResult(Object value, int errorCode, string message)
        {
            this._Value = value;
            this._ErrorCode = errorCode;
            this._Message = message;
        }
        public AjaxProResult(Object value, int errorCode)
            : this(value, errorCode, "")
        {
        }
        public AjaxProResult(Object value)
            : this(value, 0, "")
        {
        }
        public AjaxProResult()
        {
        }
    }

    public class SelfCommon
    {
        public static string SetOrder(ref Hashtable orderDesc,  string curField)
        {
            string temp = curField;
            if (orderDesc.Contains(temp))
            {
                if (orderDesc[temp].ToString() == "desc")
                {
                    orderDesc[temp] = "";
                }
                else
                {
                    orderDesc[temp] = "desc";
                }
            }
            else
            {
                orderDesc[temp] = "";
            }

            temp += " " + orderDesc[temp].ToString();
            return temp;
        }
        public static string GetConfig(string key)
        {
            string result = "";
            if (System.Configuration.ConfigurationManager.AppSettings[key] != null)
            {
                result = System.Configuration.ConfigurationManager.AppSettings[key].ToString();
            }
            return result;
        }
       
        public static string ReplaceStr(string iStr)
        {
            iStr = iStr.Replace("'", "['']");
            iStr = iStr.Replace("_", "[_]");
            iStr = iStr.Replace("%", "[%]");
            return iStr;
        }
        public static string ReplaceStrForJavaScript(string iStr)
        {
            iStr = iStr.Replace("'", "\\'");
            iStr = iStr.Replace("\"", "\\\"");
            return iStr;
        }

    }

    public enum TrainStatus
    {
        New,
        Update,
        Deleted
    }

    public enum TrainType
    {
        Empty,
        InnerSection, //段内培训     
        InnerBase,    //基地内培训
        Outer     //基地外培训,段外培训
    }

    public enum ViewTrainType
    {
        Empty,
        Station,//站段菜单进入
        Workshop //车间菜单进入
    }

    public enum BureauType
    {
        Empty,
        InnerBureau,
        OuterBureau
    }

    public enum CourseType
    {
        Theory,
        Practice
    }

    public enum TrainInfoFormStatus
    {
        Empty,
        New,
        Edit,
        View
    }

    public enum TrainAttendanceStatus
    {  
        NoSet,
        Empty,
        Present,
        PublicHolidays,
        SickLeave,
        Leave,
        Absenteeism        
    }
    public enum TrainInfoSide
    {
        Empty,
        Client, //培训查看及人员添加
        Admin  //培训维护
    }

    public enum EnumNationality
    {
        汉族,
        少数民族
    }

    public enum EnumAdminUserType
    {
        View = 1,
        Edit = 2
    }
}
